﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace JBot.Dialogs {
	/// <summary>
	/// Interaction logic for Window2.xaml
	/// </summary>
	public partial class AddContactWindow : Window {
		public AddContactWindow( ) {
			this.InitializeComponent( );

			// Insert code required on object creation below this point.
		}

		private void textBoxUsername_KeyDown(object sender, KeyEventArgs e) {
			if (e.Key == Key.D2 && e.KeyboardDevice.Modifiers == ModifierKeys.Shift) {
				e.Handled = true;
				this.comboBoxServername.Focus( );
			}
		}

		private void buttonOk_Click(object sender, RoutedEventArgs e) {
			App.xmpp.addRosterItem(this.textBoxUsername.Text + "@" + this.comboBoxServername.Text, this.textBoxNickname.Text, this.comboBoxGroup.Text);
			this.DialogResult = true;
			this.Close( );
		}

		private void buttonCancel_Click(object sender, RoutedEventArgs e) {
			this.Close( );
		}
	}
}